<style type="text/css">
	.delete_input_head {
		cursor: pointer;
	}
	.order_brand {
		border: 1px solid #ddd;
		width: 40px;
		height: 15px;
		line-height: 15px;
		text-align: center;	
	}
	.save_img {
		width: 13px;
		height: 13px;
		border: none;
	}
	.img_std_admin {
	    display: table;
	    height: 152px;
	    padding: 5px 0;
	    width: 208px;
	}
	.img_std_admin div {
	    display: table-cell;
	    vertical-align: middle;
		text-align: center; 
	}
	.sp_indexsub_img {
	    border: medium none;
	    height: auto !important;
	    max-height: 140px;
	    max-width: 190px;
	    min-height: 80px;
	    min-width: 100px;
	    width: auto !important;
	}
	.nbm_prd {
		text-decoration: underline;
	}
	table.content_ct_show_ct_tbl tr.content_ct_show_ct_tbl_bt_2 a.nbm_prd:hover{
		color: #FF9933;	
	}
</style>

<!-- js validate form  -->
<script type="text/javascript">
function submitform()
{
  document.myform.submit();
}
</script>

<div class="content_head">
	<?php echo $title; ?>
</div>	
<div class="content_ct">
	<div class="content_ct_search">
		<table class="content_ct_search_tbl"  width="100%">
			<form method="POST" action="<?php echo base_url() ?>back_end/product/search">    
				<tr>
					<td width="10%">
						<span>Tên sản phẩm:</span>
					</td>
					<td width="10%">
						<input  class="content_ct_search_tbltxt" name="nameSearch" value="<?php if(isset($_SESSION['like_suppliers'])){ echo $_SESSION['like_suppliers']['name']; } ?>" type="text" />
					</td>
					<td width="40%"></td>
					<td width="40%"></td>
				</tr>
				<tr>
					<td width="10%">
						<span>Danh mục sản phẩm:</span>
					</td>
					<td width="10%">
						<select name="category_product_id" class="content_ct_search_tblselect" >
							<option value="0">------ Chọn danh mục sản phẩm ------</option>
							<?php
								foreach ($category_product as $category_product_key => $category_product_value) { 
							?>
							<option value="<?php echo $category_product_key; ?>">
								<?php echo $category_product_value; ?>
							</option>
							<?php
								} 
							?>
						</select>
					</td>
					<td width="40%"></td>
					<td width="40%"></td>
				</tr>	
				<tr>
					<td width="10%">
						<span>Nơi xuất xứ:</span>
					</td>
					<td width="10%">
						<select name="origin_id" class="content_ct_search_tblselect" >
								<option value="0">------ Chọn nơi xuất xứ ------</option>
								<?php
									foreach ($origin as $origin_arr) { 
								?>
								<option value="<?php echo $origin_arr['id']; ?>">
									<?php echo $origin_arr['name']; ?>
								</option>
								<?php
									} 
								?>
							</select>
					</td>
					<td width="40%"></td>
					<td width="40%"></td>
				</tr>
				<tr>
					<td width="10%">
						<span>Thương hiệu:</span>
					</td>
					<td width="10%">
						<select name="brand_id" class="content_ct_search_tblselect" >
							<option value="0">------ Chọn thương hiệu ------</option>
							<?php
								foreach ($brand as $brand_arr) { 
							?>
							<option value="<?php echo $brand_arr['id']; ?>">
								<?php echo $brand_arr['name']; ?>
							</option>
							<?php
								} 
							?>
						</select>
					</td>
					<td width="40%"></td>
					<td width="40%"></td>
				</tr>
				<tr>
					<td width="10%">
						<span>Nhà cung cấp:</span>
					</td>
					<td width="10%">
						<select name="suppliers_id" class="content_ct_search_tblselect" >
							<option value="0">------ Chọn nhà cung cấp ------</option>
							<?php
								foreach ($suppliers as $suppliers_arr) { 
							?>
							<option value="<?php echo $suppliers_arr['id']; ?>" >
								<?php echo $suppliers_arr['name']; ?>
							</option>
							<?php
								} 
							?>
						</select>
					</td>
					<td width="40%"></td>
					<td width="40%"></td>
				</tr>		
				<tr>
					<td></td>
					<td>
						<input id="input_checkbox_2" style="cursor:pointer;" type="submit" name="formSearch" value="Tìm kiếm" />
						<input style="cursor:pointer;" type="reset" value="Reset" />
					</td>
					<td></td>
					<td></td>
				</tr>
			</form>
		</table>
		
	</div>
	<!-- end content_ct_search -->
	
	<form name="myform" id="frmForm" method="POST" action="<?php echo base_url()?>back_end/product/delete_all" >
	
	<div class="content_ct_show">	
		<div class="content_ct_show_abs">
			<?php echo $this->session->flashdata('msview'); ?>
		</div>
		<div class="content_ct_show_paging">
			&nbsp;
		</div>		
		<div class="content_ct_show_head">
			<input class="delete_input_head" type="submit" value="Xóa" />
			<a class="add_new" href="<?php echo base_url()?>back_end/product/add">Thêm mới sản phẩm</a>
			<span style="padding-left: 5px; color: #FF9933;" class="count_check"></span>
		</div>
		
	<div id="load">	
			<div class="content_ct_show_ct">
				<table class="content_ct_show_ct_tbl" width="100%">   
					<tr class="content_ct_show_ct_tbl_top">
						<td width="1%">
							<input type="checkbox" class="input_checkall" />
						</td>
						<td width="4%">
	                    	<a class="link_change" href="<?php echo base_url() ?>back_end/product/sort/id/<?php echo $sort; ?>">ID</a>
						</td>
						<td width="20%">
	                    	<a class="link_change" href="<?php echo base_url() ?>back_end/product/sort/name/<?php echo $sort; ?>">Tên sản phẩm</a>
						</td>
						<td width="20%">
	                    	<a class="link_change" href="<?php echo base_url() ?>back_end/product/sort/category_product_id/<?php echo $sort; ?>">Danh mục sản phẩm</a>
						</td>
						<td width="15%">
	                    	<a class="link_change">Ảnh sản phẩm</a>
						</td>
						<td width="8%">
	                    	<a class="link_change" href="<?php echo base_url() ?>back_end/product/sort/admin_id/<?php echo $sort; ?>">Người tạo</a>
						</td>
						<td width="8%">
	                    	<a class="link_change" href="<?php echo base_url() ?>back_end/product/sort/view/<?php echo $sort; ?>">Lượt xem</a>
						</td>
						<td width=7%">
							<a class="link_change" href="<?php echo base_url() ?>back_end/product/sort/create_date/<?php echo $sort; ?>">Ngày tạo</a>
						</td>
						<td width=7%">
							<a class="link_change" href="<?php echo base_url() ?>back_end/product/sort/edit_date/<?php echo $sort; ?>">Ngày sửa</a>
						</td>
						<td width="5%">
							<a class="link_change" href="<?php echo base_url() ?>back_end/product/sort/status/<?php echo $sort; ?>">Trạng thái</a>
						</td>
						<td width="5%">
							<span>Action</span>
						</td>
					</tr>
					
					<?php
	                	$count = 1; 
	                	if (count($query_prd) > 0) {
	                		foreach ($query_prd as $value) {
	                		$count += 1;	 
	                ?> 
					<tr class="<?php if ($count%2) { echo 'content_ct_show_ct_tbl_bt_1'; } else { echo 'content_ct_show_ct_tbl_bt_2'; }  ?>">
						<td>
							<input class="input_checkbox" type="checkbox"  value="<?php echo $value['id']; ?>" name="value_id[]"/>
						</td>
						<td>
							<span><?php echo $value['id']; ?></span>
						</td>
						<td>
							<a class="nbm_prd" style="color: #333;"  href="<?php echo base_url()?>back_end/product/add/1/<?php  echo $value['id']; ?>">
								<?php echo $value['name']; ?>
							</a>
						</td>
						<td>
							<span><?php echo $value['category_product_name']; ?></span>
						</td>
						<td>
							<?php
								if ($value['image'] == '') {
							?>
							<div class="img_std_admin">
								<div>
									<img src="<?php echo base_url();?>images/img_product/noimg.jpg"  class="sp_indexsub_img">
								</div>	
							</div>	
							<?php 		
								} else { 
							?>
							<div class="img_std_admin">
								<div>
									<img src="<?php echo base_url();?>images/img_product/<?php echo $value['image']; ?>"  class="sp_indexsub_img">
								</div>	
							</div>
							<?php
								} 
							?>
						</td>
						<td>
							Người tạo
						</td>
						<td>
							Lượt xem
						</td>
						<td>
							<span><?php echo $value['create_date']; ?></span>
						</td>
						<td>
							<span><?php echo $value['edit_date']; ?></span>
						</td>
						<td>
							<?php if($value['status'] == 1) { ?>
	                    		<a class="tag_action" href="<?php echo base_url()?>back_end/admins/active/<?php echo $table.'-'.$value['id'].'-'.'0'.'-'.$table; ?>"><img src="<?php echo base_url()?>images/back_end/icon/check2.png" title="Trạng thái" alt="icon check" /></a>
	                    	<?php } else { ?>
	                 			<a class="tag_action" href="<?php echo base_url()?>back_end/admins/active/<?php echo $table.'-'.$value['id'].'-'.'1'.'-'.$table; ?>"><img src="<?php echo base_url()?>images/back_end/icon/check.png" title="Trạng thái" alt="icon check" /></a>
	                    	<?php }?>
						</td>
						<td>
							<a href="<?php echo base_url()?>back_end/product/add/1/<?php  echo $value['id']; ?>">Sửa</a>
							<span>|</span>
							<a href="<?php echo base_url()?>back_end/product/delete/<?php  echo $value['id']; ?>">Xóa</a>
						</td>
					</tr>
					<?php }
					 	} else {
					?>
					<tr>
						<td colspan="11"><i style="color: #000;">Không có kết quả nào được tìm thấy</i></td>
					</tr> 
					 <?php
					 	} 
					 ?>
				</table>
			</div>
			
			<div class="content_ct_show_paging">
				<span style="color: #888;">Tổng số:</span>
				<span style="color: #444;">(<?php echo $this->pagination->total_rows; ?>)</span>
				<?php echo $this->pagination->create_links(); ?>
			</div>			
		</div>
	</div>	
	</form>
	<!-- end content_ct_show -->
</div>

